#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include <stdlib.h>

void Sig_Handler(int num) {
    printf("Sig Num = %d\n", num);
}

int main()
{
    signal(SIGINT, Sig_Handler);
    signal(SIGALRM, Sig_Handler);

    int ret = alarm(5);
    printf("第一个: ret = %d\n", ret);

    sleep(2);
    ret = alarm(8);
    printf("第二个: ret = %d\n", ret);

    while(1) {
        sleep(1);
    }

    return 0;
}

